Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mdit-vue/plugin-sfc

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mdit-vue/plugin-sfc

A markdown-it plugin to help transforming markdown tu vue sfc

  • 0.9.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@mdit-vue/plugin-sfc

npm license

A markdown-it plugin to help transforming markdown to Vue SFC.

  • Avoids rendering <script> and <style> tags and extract them into to markdown-it env.sfcBlocks.
  • Supports extracting custom blocks.
  • Provides env.sfcBlocks.template for convenience.

Install

npm i @mdit-vue/plugin-sfc

Usage

This plugin will only take effects when the html option of markdown-it is enabled:

import MarkdownIt from 'markdown-it';
import { sfcPlugin } from '@mdit-vue/plugin-sfc';
import type { MarkdownItEnv } from '@mdit-vue/types';

const md = MarkdownIt({ html: true }).use(sfcPlugin, {
  // options
});
const env: MarkdownItEnv = {};

const rendered = md.render(
  `\
# foo

<script>
console.log('bar')
</script>
`,
  env,
);

console.log(env.sfcBlocks);

Options

customBlocks

  • Type: string[]

  • Default: []

  • Details:

    SFC custom blocks to be extracted.

    By default, only <script> and <style> tags will be extracted. You can set this option to support SFC custom blocks in markdown.

    For example, if you set this option to ['i18n'], the <i18n> tag in your markdown content will be extracted to env.sfcBlocks.customBlocks and won't appear in the rendered result.

Keywords

FAQs

Package last updated on 18 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc